import React,{ Component } from 'react';
import { Redirect } from 'react-router-dom';
import {connect } from 'react-redux';


class Write extends  Component {
    render() {
        if(this.props.login){
            return(
                <div>写文字</div> 
            )
        }else{
            return (
                <Redirect to="/login" />
            )
        }

    }
}


const mapStateToProps=(state)=>{
    return{
        //immutabled对象的get方法
        login:state.getIn(['login','login']),
    }
};

export default connect(mapStateToProps,null)(Write);
